package com.inhg.inhg_android.net;

import com.inhg.inhg_android.Api;
import com.jakewharton.retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;

import java.util.concurrent.TimeUnit;

import okhttp3.OkHttpClient;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * Created by ZengYan on 2017/7/19.
 * Email : 810989881@qq.com
 *
 * @decs : 请求工具
 */

public class RxHttpUtils {

    
    private static RxHttpUtils instance ;

    private Retrofit mRetrofit;

    private RxHttpUtils(){
        mRetrofit = RetrofitClient.getInstance().getRetrofit();
    }

    /**
     * @return 返回单例
     */
    public static RxHttpUtils getInstance(){
        if (instance == null) {
            synchronized (RxHttpUtils.class){
                if (instance == null) {
                    instance = new RxHttpUtils() ;
                }
            }
        }
        return instance ;
    }

    public <T> T create(final Class<T> service){
        return mRetrofit.create(service);
    }


}
